Learn R Programming

GLDEX (version 2.0.0.9.3)

skewness and kurtosis: Compute skewness and kurtosis statistics

Description

This uses the S+ version directly.

Usage

skewness(x, na.rm = FALSE, method = "fisher")
kurtosis(x, na.rm = FALSE, method = "fisher")

Value

A single value of skewness or kurtotis.

If y = x - mean(x), then the "moment" method computes the skewness value as mean(y\(\mbox{\textasciitilde}\)3)/mean(y\(\mbox{\textasciitilde}\)2) \(\mbox{\textasciitilde}\)1.5 and the kurtosis value as mean(y\(\mbox{\textasciitilde}\)4)/mean(y \(\mbox{\textasciitilde}\)2)\(\mbox{\textasciitilde}\)2 - 3. To see the "fisher" calculations, print out the functions.

Arguments

x

Any numerical object. Missing values NA are allowed.

na.rm

Logical flag: if na.rm=TRUE, missing values are removed from x before doing the computations. If na.rm=FALSE and x contains missing values, then the return value is NA.

method

Character string specifying the computation method. The two possible values are fisher for Fisher's g1 (skewness) and g2 (kurtosis) versions, and moment for the functional forms of the statistics. Only the first character of the string needs to be supplied.

Author

Splus

Details

The moment forms are based on the definitions of skewness and kurtosis for distributions; these forms should be used when resampling (bootstrap or jackknife). The "fisher" forms correspond to the usual "unbiased" definition of sample variance, though in the case of skewness and kurtosis exact unbiasedness is not possible.

See Also

var

Examples

Run this code
x <- runif(30) 
skewness(x) 
skewness(x, method="moment") 
kurtosis(x) 
kurtosis(x, method="moment") 

Run the code above in your browser using DataLab